package api

import (
	"gitee.com/kristas/booting-go/framework"
	"gitee.com/kristas/booting-go/framework/core/statement/types"
	"gitee.com/kristas/booting-go/framework/web/rest"
	"gitee.com/kristas/booting-go/internal/demo/service"
)

func init() {
	framework.Component(new(DemoCacheController))
}

type DemoCacheController struct {
	types.Controller `group:"/api/v1/cache"`
	service.Factory  `wire:"service_factory"`
	saveCache        rest.POST `url:"/save/{key}" param:"[key path,value query]"`
	getCache         rest.GET  `url:"/get/{key}" param:"[key path]"`
}

func (r *DemoCacheController) SaveCache(key, value string) interface{} {
	return r.GetDemoCacheService().SaveCache(key, value)
}

func (r *DemoCacheController) GetCache(key string) interface{} {
	return r.GetDemoCacheService().GetFromCache(key)
}
